const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show2:false,
    can:'',//参数
    ios:app.globalData.ios,//是否为ios
    show:false,//激活码弹框
    type:3,//
    jinqun:'',//进群参数
    content:'',//会员说明
    userinfo:'',//用户信息
    domian:app.globalData.domian
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      can:wx.$cache.get('can'),
      ios:app.globalData.ios,
      domian:app.globalData.domian
    })
    this.my()
 
  },
  show(){
    this.setData({
      show:true
    })
  },
  show2(){
    console.log('执行')
    this.setData({
      show:true,
      type:3
    })
  },
  wxParse() {
    var that = this;
    WxParse.emojisInit('[]', "/wxParse/emojis/", {
      "00": "00.gif",
      "01": "01.gif",
      "02": "02.gif",
      "03": "03.gif",
      "04": "04.gif",
      "05": "05.gif",
      "06": "06.gif",
      "07": "07.gif",
      "08": "08.gif",
      "09": "09.gif",
      "09": "09.gif",
      "10": "10.gif",
      "11": "11.gif",
      "12": "12.gif",
      "13": "13.gif",
      "14": "14.gif",
      "15": "15.gif",
      "16": "16.gif",
      "17": "17.gif",
      "18": "18.gif",
      "19": "19.gif",
    });
    /**
     * html解析示例
     */
    var article = that.data.content;
    WxParse.wxParse('article', 'html', article, that, 5);
  },
  xu(){//续费会员
    var that = this
    var params = {
      type:1
    }
    wx.$http.get(wx.$get.pay_library,params,'支付...').then(res=>{
      console.log('续费', res)
      wx.requestPayment({
        timeStamp: res.timeStamp,
        nonceStr: res.nonceStr,
        package: res.package,
        signType: 'MD5',
        paySign: res.paySign,
        success (res) {
          that.my2()
        
         },
        fail (res) { }
      })
    })
  },
  my(){//我的
    var that = this
    var params = {
      
    }
    wx.$http.get(wx.$get.get_member_info,{}).then(res=>{
      if(!res.vip_time){
        res.vip_time=0
      }
      this.setData({
        userinfo:res
      })
      console.log('我的', res)
      wx.$cache.set('userinfo',res)
    })
  },
  my2(){//我的
    var that = this
    this.setData({
      show2:true,
      type:2,
    })
    var params = {
      
    }
    wx.$http.get(wx.$get.get_member_info,{}).then(res=>{
      if(!res.vip_time){
        res.vip_time='1970-01-01'
      }
      this.setData({
        userinfo:res
      })
      console.log('我的', res)
      wx.$cache.set('userinfo',res)
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    return{
      title:network.get('fx').title,
      imageUrl:network.get('fx').img,
      path:`/pages/index/index?pid=${network.get('member_id')}`
    }
  }
})